package com.edu.service;

import com.edu.test01.mapper.User01Mapper;
import com.edu.test02.mapper.User02Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired
    private User01Mapper user01Mapper;
    @Autowired
    private User02Mapper user02Mapper;

    @Transactional
    public int insert1And2(){
        user02Mapper.insert(7,"test02","28");
        System.err.println("数据库 02 开始");
        user01Mapper.insert(7,"test01","28");
        int i = 1/0;
        return  0;
    }
}
